package com.boscloud.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.boscloud.pojo.GetProductionInboundInfo;
import com.boscloud.pojo.PostGoodMvtResult;
import com.boscloud.pojo.RawMaterialInboundInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.boscloud.service.GetProductionInboundService;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@CrossOrigin //允许跨域
@RestController
public class GetProductionInboundController {
    @Autowired
    private GetProductionInboundService GetProductionInboundService;
    @PostMapping("/GetProductionInboundList")//扫描条码--获取生产入库信息
    public List<GetProductionInboundInfo> getGetProductionInboundList(@RequestBody Map<String, Object> params) throws IOException {
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("PORTID","ITMS005");//接口ID
        return GetProductionInboundService.getGetProductionInboundList(params,headers);
    }
    @PostMapping("/PostProductionInbound")//原料入库
    public List<PostGoodMvtResult> PostRawMaterialInbound(@RequestBody GetProductionInboundInfo GetProductionInboundInfo) throws IOException {
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("PORTID","ITMS007");//接口ID
        Map<String, Object> params  = JSONObject.parseObject(JSON.toJSONString(GetProductionInboundInfo));
        return GetProductionInboundService.PostProductionInbound(params,headers);
    }
}
